package com.topwater.topwater.service.impl;

import com.topwater.topwater.entity.RdChangevalue;
import com.topwater.topwater.dao.RdChangevalueDao;
import com.topwater.topwater.service.RdChangevalueService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import javax.annotation.Resource;

/**
 * (RdChangevalue)表服务实现类
 *
 * @author 胡文 qq:986776
 * 自定义生成器制造
 */
@Service("rdChangevalueService")
public class RdChangevalueServiceImpl implements RdChangevalueService {
    @Resource
    private RdChangevalueDao rdChangevalueDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RdChangevalue queryById(Integer id) {
        return this.rdChangevalueDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param rdChangevalue 实例对象
     * @return 实例对象
     */
    @Override
    public RdChangevalue insert(RdChangevalue rdChangevalue) {
        this.rdChangevalueDao.insert(rdChangevalue);
        return rdChangevalue;
    }

    @Override
    public RdChangevalue insertNotNull(RdChangevalue rdChangevalue) {
        this.rdChangevalueDao.insertNotNull(rdChangevalue);
        return rdChangevalue;
    }

    /**
     * 修改数据
     *
     * @param rdChangevalue 实例对象
     * @return 实例对象
     */
    @Override
    public RdChangevalue update(RdChangevalue rdChangevalue) {
        this.rdChangevalueDao.update(rdChangevalue);
        return this.queryById(rdChangevalue.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.rdChangevalueDao.deleteById(id) > 0;
    }

    /**
     * 字符串自动模糊查询
     **/
    public List<RdChangevalue> queryByLike(RdChangevalue rdChangevalue) {
        return this.rdChangevalueDao.queryByLike(rdChangevalue);
    }

    public List<RdChangevalue> queryByLike2(String str) {
        return this.rdChangevalueDao.queryByLike2(str);
    }

    /**
     * 多表连接查询
     */
    public List<Map> queryJoin(@Param("rdChangevalue") RdChangevalue rdChangevalue, @Param("tables") String... tables) {
        return this.rdChangevalueDao.queryJoin(rdChangevalue, tables);
    }
}
